#!/usr/bin/python
# -*- coding: utf-8 -*-
# @version        : 1.0
# @Create Time    : 2024/12/18 22:20
# @File           : inventory.py
# @IDE            : PyCharm
# @desc           : pydantic 模型，用于数据库序列化操作

from pydantic import BaseModel, Field, ConfigDict
from core.data_types import DatetimeStr


class Inventory(BaseModel):
    custom: str = Field(..., title="客户名称")
    weigh_id: int = Field(..., title="地磅名称")
    type: str = Field(..., title="品类")
    model: str = Field(..., title="规格")
    warehouse_number: int = Field(..., title="仓号")
    net_weight: int = Field(..., title="净重")
    out_ticket: str = Field(..., title="出厂票号")
    driver: str = Field(..., title="司机")
    car_number: str = Field(..., title="车牌")
    actual_inventory: int = Field(..., title="实际入库量(吨)")
    notes: str = Field(..., title="备注")


class InventorySimpleOut(Inventory):
    model_config = ConfigDict(from_attributes=True)

    id: int = Field(..., title="编号")
    create_datetime: DatetimeStr = Field(..., title="创建时间")
    update_datetime: DatetimeStr = Field(..., title="更新时间")
